<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="include/head::commonHeaderCustomList('活动赠送管理',~{::style})">
    <style type="text/css">
        @media screen and (max-width: 1100px) {
            .layui-layer-iframe {
                overflow-y: visible !important;
            }
        }
    </style>
</head>
<body>
<div id="content" class="col-lg-12 col-sm-12" style="padding: 5px;">
    <div class="row">
        <div class="box col-md-12">
            <div class="box-inner">
                <div class="box-header well" data-original-title="">
                    <h2>
                        <i class="glyphicon glyphicon-home"></i> 活动赠送列表
                    </h2>
                </div>
                <div class="box-content">
                    <form class="form-inline form-search" role="form" method="post" action="/activity/give/page/list" onsubmit="return true;">
                    </form>
                    <div class="col-xs-12">
                        <button class="btn btn-info add" style="float: right;margin-bottom: 5px;">
                            <span class="glyphicon glyphicon-plus-sign"></span> 发布活动赠送
                        </button>
                    </div>
                    <table class="table table-striped table-bordered table-hover" data-show-toggle="false">
                        <thead>
                        <tr>
                            <th style="text-align: center;">#</th>
                            <th style="text-align: center;">活动赠送名称</th>
                            <th style="text-align: center;">发布日期</th>
                            <th style="text-align: center;">发布人</th>
                            <th style="text-align: center;">赠礼</th>
                            <th style="text-align: center;">套餐生效类型</th>
                            <th style="text-align: center;">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr th:each="act,iterStat : ${pageInfo.list}">
                            <td style="text-align: center;" th:text="${iterStat.index+1}">sort</td>
                            <td style="text-align: center;" th:text="${act.activity}">activity</td>
                            <td style="text-align: center;" th:text="${#dates.format(act.recordTime,'yyyy-MM-dd HH:mm:ss')}">recordTime</td>
                            <td style="text-align: center;" th:text="${act.recorder}">recorder</td>
                            <td style="text-align: center;" th:text="${act.gift}">gift</td>
                            <td style="text-align: center;" th:text="${act.packageType==1?'即时生效':'正式套餐或促销后生效'}">packageType</td>
                            <td style="text-align: center;">
                                <a href="javascript:;" class="btn btn-danger show-stu" role="button" th:alt="${act.id}"><span class="glyphicon glyphicon-edit"></span> 赠送名单 </a>
                                <a href="javascript:;" class="btn btn-info export" role="button" th:alt="${act.id}"><span class="glyphicon glyphicon-export"></span> 导出Excel </a>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <div th:include="include/pageinfo::pager"></div>
                </div>
            </div>
            <!--/box-->
        </div>
        <!--/row-->
    </div>
    <!-- content ends -->
    <div th:include="include/onload_js::onloadJSCustomList(~{::script})">
        <script type="text/javascript" th:inline="javascript">
            $(function () {
                $(".add").on("click", function () {
                    var url = "/activity/give/page/student/import";
                    layer.open({
                        type: 2,
                        title: false,
                        closeBtn: 1, //显示关闭按钮
                        // shade: [0],
                        shade: 0.4,
                        area: ['560px', '600px'],
                        // offset: 'rb', //右下角弹出
                        // time: 2000, //2秒后自动关闭
                        // anim: 2,
                        content: [url, 'no'], //iframe的url，no代表不显示滚动条
                        end: function () { //此处用于演示
                        },
                        cancel: function (index, layero) {
                            window.location.reload();
                        }
                    });
                });

                $(".show-stu").on("click", function () {
                    var id = $(this).attr("alt");
                    var url = "/activity/give/page/student/list?agId=" + id;
                    layer.open({
                        type: 2,
                        title: false,
                        closeBtn: 1, //显示关闭按钮
                        // shade: [0],
                        shade: 0.4,
                        area: ['560px', '600px'],
                        // offset: 'rb', //右下角弹出
                        // time: 2000, //2秒后自动关闭
                        // anim: 2,
                        content: [url, 'no'], //iframe的url，no代表不显示滚动条
                        end: function () { //此处用于演示
                        },
                        cancel: function (index, layero) {
                        }
                    });
                });

                $(".export").on("click", function () {
                    var id = $(this).attr("alt");
                    var url = "/activity/student/exportExcel?agId=" + id;
                    window.location.href = url;
                });
            });
        </script>
    </div>
</div>
</body>
</html>